home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 1 Issue 2
/
PDCD-1 - Issue 02.iso
/
_utilities
/
utilities
/
001
/
_resizer
/
!Resizer
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1993-03-02
|
20KB
|
706 lines
Forward>>Motion Resizer
Window Resizer - Microsoft Windows style
Forward>>Motion
S O F T W A R E
Nick Jarman Thu,24 Dec 1992
version$="1.12 (02-Mar-93)"
"Wimp_Initialise",200,&4B534154,"Resizer"
,task_handle%
initialise
finish%=
error
finish%
wimp_poll
finish%
"Wimp_CloseDown"
still_open(handle%,address%)
error_occurred%,result%
error_occurred%=
result%=
:error_occurred=
error_occurred%=
handle%<>-1
address%!&100=handle%
/
"Wimp_GetWindowState",,address%+&100
+
address%!&120
1<<16
result%=
=648
window_handle%<>
"$ address%!&100=window_handle%
# other_window_handle%<>-1
window_handle%=
%-
"Wimp_DeleteWindow",,address%!&100
result%=
=result%
which_area(mouse_x%,mouse_y%,x%,y%)
area%,width%,height%
area%=-1
0Ewidth%=old_max_x%-old_min_x%+v_scrollbar_width%+(border_width%*2)
1Xheight%=old_max_y%-old_min_y%+h_scrollbar_height%+titlebar_height%+(border_width%*2)
area%=-1
mouse_x%<=x%+corner_size%
mouse_y%<=y%+corner_size%
area%=6
7/
mouse_y%>=y%+height%-corner_size%-2
area%=0
9
area%=7
;
mouse_x%>=x%+width%-corner_size%-2
?%
mouse_y%<=y%+corner_size%
area%=4
A
B1
mouse_y%>=y%+height%-corner_size%-2
area%=2
area%=3
G
I%
mouse_y%<=y%+corner_size%
area%=5
K
area%=1
M
=area%
window_number_from_handle(handle%)
number%
number%=0
handle%(number%)<>handle%
number%<no_windows%
number%+=1
number%=no_windows%
number%=-1
=number%
change_value(value%,change%)
value%
border_width%+=change%
bG
border_width%<10
border_width%>100
border_width%-=change%
c)
corner_size%<=border_width%-2
d& corner_size%=border_width%+2
e: $(!(prefs_template%+112+(7*32)))=
(corner_size%)
f+
redraw_icon(prefs_template%!0,7)
g
h9 $(!(prefs_template%+112+(3*32)))=
(border_width%)
i)
redraw_icon(prefs_template%!0,3)
j create_window_pending%=
corner_size%+=change%
mD
corner_size%<20
corner_size%>200
corner_size%-=change%
n)
corner_size%<=border_width%-2
o& border_width%=corner_size%-2
p; $(!(prefs_template%+112+(3*32)))=
(border_width%)
q+
redraw_icon(prefs_template%!0,3)
r
s8 $(!(prefs_template%+112+(7*32)))=
(corner_size%)
t)
redraw_icon(prefs_template%!0,7)
u create_window_pending%=
sleep_time%+=change%
x?
sleep_time%<4
sleep_time%>40
sleep_time%-=change%
y8 $(!(prefs_template%+112+(11*32)))=
(sleep_time%)
z*
redraw_icon(prefs_template%!0,11)
click(address%)
window%,icon%,buttons%,mouse_x%,mouse_y%,area%
mouse_x%=address%!0
mouse_y%=address%!4
buttons%=address%!8
window%=address%!12
icon%=address%!16
window%
window_handle%
$ address%!&100=window_handle%
/
"Wimp_GetWindowState",,address%+&100
area%=8
J area%=
which_area(mouse_x%,mouse_y%,address%!&104,address%!&108)
buttons%
# menublock%!60=&07000101
A
"Wimp_CreateMenu",,menublock%,mouse_x%-64,mouse_y%
area%<>-1
drag_type%=area%
* address%!&100=window_handle%
address%!&104=1
address%!&118=0
address%!&11C=0
! address%!&120=10000
! address%!&124=10000
.
"Wimp_DragBox",,address%+&100
prefs_handle%
buttons%
icon%
5
change_value(1,4-(8
buttons%=1))
5
change_value(1,4-(8
buttons%=4))
5
change_value(2,4-(8
buttons%=1))
5
change_value(2,4-(8
buttons%=4))
6
change_value(3,1-(2
buttons%=1))
6
change_value(3,1-(2
buttons%=4))
/ address%!&100=prefs_template%!0
address%!&104=14
5
"Wimp_GetIconState",,address%+&100
M
address%!&118
1<<21
absolute_drag%=
absolute_drag%=
!
save_preferences
6
"Wimp_CloseWindow",,prefs_template%
/ border_width%=old_border_width%
- corner_size%=old_corner_size%
+ sleep_time%=old_sleep_time%
1 absolute_drag%=old_absolute_drag%
A $(!(prefs_template%+112+(3*32)))=
(border_width%)
@ $(!(prefs_template%+112+(7*32)))=
(corner_size%)
@ $(!(prefs_template%+112+(11*32)))=
(sleep_time%)
{ !(prefs_template%+108+(14*32))=(!(prefs_template%+108+(14*32))
(1<<21))))
(1+(absolute_drag%=
))<<21
( create_window_pending%=
7
"Wimp_DeleteWindow",,prefs_template%
I
"Wimp_CreateWindow",,prefs_template%+4
prefs_handle%
/ prefs_template%!0=prefs_handle%
6
"Wimp_CloseWindow",,prefs_template%
# menublock%!60=&07400101
A
"Wimp_CreateMenu",,menublock%,mouse_x%-64,mouse_y%
close_window(handle%)
word%, number%
!block%=handle%
"Wimp_GetWindowState",,block%
/number%=
window_number_from_handle(handle%)
word%=1
/ co_ords(number%,word%-1)=block%!(word%*4)
word%
open%(number%)=
"Wimp_CloseWindow",,block%
create_backwindow(address%)
window_handle%<>
" address%!&100=window_handle%
"Wimp_DeleteWindow",,address%+&100
&address%!&100=other_window_handle%
"Wimp_GetWindowState",,address%+&100
address%!&120
1<<29
old_min_x%=address%!&104
old_min_y%=address%!&108
old_max_x%=address%!&10C
old_max_y%=address%!&110
old_on_top%=address%!&11C
" old_highlight%=address%!&120
/ template%!4=(address%!&104)-border_width%
/ template%!8=(address%!&108)-border_width%
0 template%!12=(address%!&10C)+border_width%
0 template%!16=(address%!&110)+border_width%
titlebar_height%=0
v_scrollbar_width%=0
h_scrollbar_height%=0
address%!&120
1<<20
template%?39=12
template%?39=2
address%!&120
1<<31
F
address%!&120
1<<26
template%!16+=40:titlebar_height%=40
H
address%!&120
1<<28
template%!12+=40:v_scrollbar_width%=40
H
address%!&120
1<<30
template%!8-=40:h_scrollbar_height%=40
E
address%!&120
1<<0
template%!16+=40:titlebar_height%=40
G
address%!&120
1<<2
template%!12+=40:v_scrollbar_width%=40
G
address%!&120
1<<3
template%!8-=40:h_scrollbar_height%=40
% width%=template%!12-template%!4
& height%=template%!16-template%!8
template%!44=0
template%!48=0
template%!52=width%
template%!56=height%
template%!28=address%!&100
"Wimp_CreateWindow",,template%+4
window_handle%
template%!0=window_handle%
"Wimp_OpenWindow",,template%
other_window_handle%=-1
window_handle%=
error
result%
=648
other_window_handle%=-1
window_handle%<>
block%!0=window_handle%
window_handle%=
%
"Wimp_CloseWindow",,block%
&
"Wimp_DeleteWindow",,block%
MODE78:CLS:REPORT:PRINT ERR:PRINTERL:SYS "Wimp_ForceRedraw",-1,0,0,10000,10000:IF GET OSCLI("Print adfs::cathedra.$.!Boot.resources.palette"):OSCLI("POINTER"):END
block%!&100=
S $(block%+&104)=
$+" - click Cancel to quit or OK to attempt to continue"+
"Wimp_ReportError",block%+&100,%11,"Forward>>Motion Resizer"
,result%
result%=2
finish%=
initialise
template_size%=900
indirect_size%=600
no_windows%=1
drag_type%=-1
keysreleased%=
shape$="ptr_default"
last_polled%=
template% template_size%, indirect% indirect_size%, block% &800, menublock% &100,info_template% template_size%, prefs_template% template_size%
)*indirect_end%=indirect%+indirect_size%
window_handle%=
other_window_handle%=-1
last_area%=-1
create_window_pending%=
read_preferences
load_sprites
"Wimp_OpenTemplate",,"<Resizer$Dir>.Templates"
"Wimp_LoadTemplate",,template%+4,indirect%,indirect_end%,-1,"BackWindow"
,,info_indirect%
"Wimp_LoadTemplate",,info_template%,info_indirect%,indirect_end%,-1,"Info"
,,prefs_indirect%
3.$(!(info_template%+88+20+(7*32)))=version$
"Wimp_CreateWindow",,info_template%
info_handle%
"Wimp_LoadTemplate",,prefs_template%+4,prefs_indirect%,indirect_end%,-1,"Preferences"
prefs_template%!68=sprites%
75$(!(prefs_template%+112+(3*32)))=
(border_width%)
84$(!(prefs_template%+112+(7*32)))=
(corner_size%)
94$(!(prefs_template%+112+(11*32)))=
(sleep_time%)
:o!(prefs_template%+108+(14*32))=(!(prefs_template%+108+(14*32))
(1<<21))))
(1+(absolute_drag%=
))<<21
"Wimp_CreateWindow",,prefs_template%+4
prefs_handle%
<#prefs_template%!0=prefs_handle%
"Wimp_CloseTemplate"
$menublock%="Resizer"
menublock%?12=7
menublock%?13=2
menublock%?14=7
menublock%?15=0
C)menublock%!16=
"Preferences..."*16+12
menublock%!20=44
menublock%!24=0
menublock%!28=0
menublock%!32=info_handle%
menublock%!36=&07000001
$(menublock%+40)="Info"
menublock%!52=0
menublock%!56=-1
menublock%!60=&07000101
M menublock%!64=menublock%+100
menublock%!68=-1
menublock%!72=0
menublock%!76=1<<7
menublock%!80=-1
menublock%!84=&07000001
$(menublock%+88)="Quit"
T&$(menublock%+100)="Preferences..."
load_sprites
file%
[$file%=
("<Resizer$Dir>.Sprites")
sprites%
#file%+&10
sprites%!0=
#file%+&10
sprites%!4=0
sprites%!8=16
sprites%!12=16
#file%
"OS_SpriteOp",&20A,sprites%,"<Resizer$Dir>.Sprites"
message
address%!16=0
finish%=
menu_select(address%)
reopen%,width%,height%
reopen%=
"Wimp_GetPointerInfo",,address%+&100
address%!&108=1
reopen%=
address%!0
t% old_corner_size%=corner_size%
u' old_border_width%=border_width%
v# old_sleep_time%=sleep_time%
w) old_absolute_drag%=absolute_drag%
x3 width%=prefs_template%!12-prefs_template%!4
y4 height%=prefs_template%!16-prefs_template%!8
z0 prefs_template%!4=address%!&100-width%/2
{1 prefs_template%!8=address%!&104-height%/2
|3 prefs_template%!12=prefs_template%!4+width%
}4 prefs_template%!16=prefs_template%!8+height%
prefs_template%!28=-1
-
"Wimp_OpenWindow",,prefs_template%
2:finish%=
reopen%
"Wimp_CreateMenu",,menublock%
move_icon(no%,xpos%,ypos%,width%,height%)
address%
"address%=template%+92+(no%*32)
address%!0=xpos%
address%!4=ypos%
address%!8=xpos%+width%
address%!12=ypos%+height%
width%,height%,pointer_window_handle%,area%
create_window_pending%=
window_handle%<>
create_backwindow(block%)
create_window_pending%=
window_handle%<>
"Wimp_GetPointerInfo",,block%
block%!12=window_handle%
" block%!&100=window_handle%
-
"Wimp_GetWindowState",,block%+&100
D area%=
which_area(block%!0,block%!4,block%!&104,block%!&108)
area%<>last_area%
area%
2
set_pointer_shape("ptr_tlbr",12,12)
/
set_pointer_shape("ptr_tb",9,17)
2
set_pointer_shape("ptr_trbl",12,12)
0
set_pointer_shape("ptr_lr",16,10)
3
set_pointer_shape("ptr_default",0,0)
last_area%=area%
@
last_area%<>-1
set_pointer_shape("ptr_default",0,0)
last_area%=-1
other_window_handle%<>-1
# block%!0=other_window_handle%
"Wimp_GetWindowState",,block%
old_min_x%<>block%!4
old_min_y%<>block%!8
old_max_x%<>block%!12
old_max_y%<>block%!16
old_on_top%<>block%!28
old_highlight%<>block%!32
"
create_backwindow(block%)
!
(block%!32
1<<16)=0
! block%!0=window_handle%
(
"Wimp_DeleteWindow",,block%
window_handle%=
! other_window_handle%=-1
keysreleased%=
"Wimp_GetPointerInfo",,block%+&80
' pointer_window_handle%=block%!&8C
window_handle%=
keysreleased%
5 other_window_handle%=pointer_window_handle%
$
create_backwindow(block%)
keysreleased%=
7
-9))
keysreleased%
a
pointer_window_handle%=other_window_handle%
pointer_window_handle%=window_handle%
& block%!&100=window_handle%
.
"Wimp_CloseWindow",,block%+&100
/
"Wimp_DeleteWindow",,block%+&100
window_handle%=
# other_window_handle%=-1
!
"Wimp_DragBox",,-1
drag_type%=-1
7 other_window_handle%=pointer_window_handle%
&
create_backwindow(block%)
keysreleased%=
open_window(address%)
address%!0=window_handle%
open_window_border(address%)
"Wimp_OpenWindow",,address%
open_window_border(address%)
on_top%
on_top%=
drag_type%=-1
"Wimp_OpenWindow",,address%
"Wimp_GetPointerInfo",,address%+&100
address%!&108=%100
on_top%=
( address%!&100=other_window_handle%
"Wimp_GetWindowState",,address%+&100
on_top%
address%!&11C=-1
drag_type%
1 address%!&104=address%!&4+border_width%
C address%!&110=address%!&10-border_width%-titlebar_height%
absolute_drag%
B address%!&118=address%!&118+(address%!&110-old_max_y%)
B address%!&114=address%!&114-(old_min_x%-address%!&104)
C address%!&110=address%!&10-border_width%-titlebar_height%
S
absolute_drag%
address%!&118=address%!&118+(address%!&110-old_max_y%)
D address%!&10C=address%!&C-border_width%-v_scrollbar_width%
C address%!&110=address%!&10-border_width%-titlebar_height%
S
absolute_drag%
address%!&118=address%!&118+(address%!&110-old_max_y%)
D address%!&10C=address%!&C-border_width%-v_scrollbar_width%
U
absolute_drag%
address%!&114=address%!&114+(old_max_x%-address%!&10C)
E address%!&108=address%!&8+border_width%+h_scrollbar_height%
D address%!&10C=address%!&C-border_width%-v_scrollbar_width%
absolute_drag%
B address%!&114=address%!&114+(old_max_x%-address%!&10C)
B address%!&118=address%!&118-(address%!&108-old_min_y%)
E address%!&108=address%!&8+border_width%+h_scrollbar_height%
absolute_drag%
B address%!&114=address%!&114+(old_max_x%-address%!&10C)
B address%!&118=address%!&118-(address%!&108-old_min_y%)
1 address%!&104=address%!&4+border_width%
E address%!&108=address%!&8+border_width%+h_scrollbar_height%
absolute_drag%
B address%!&114=address%!&114-(old_min_x%-address%!&104)
B address%!&118=address%!&118-(address%!&108-old_min_y%)
1 address%!&104=address%!&4+border_width%
S
absolute_drag%
address%!&114=address%!&114-(old_min_x%-address%!&104)
0 address%!&104=address%!4+border_width%
!D address%!&108=address%!8+border_width%+h_scrollbar_height%
"D address%!&10C=address%!&C-border_width%-v_scrollbar_width%
#C address%!&110=address%!&10-border_width%-titlebar_height%
$+
create_backwindow(address%+&100)
"Wimp_SendMessage",2,address%+&100,other_window_handle%
address%!&104<>old_min_x%
address%!&108<>old_min_y%
address%!&10C<>old_max_x%
address%!&110<>old_max_y%
address%!&11C<>old_on_top%
address%!&120<>old_highlight%
create_backwindow(address%+&100)
read_preferences
file%,abs$
/'file%=
("<Resizer$Dir>.Preference")
file%<>0
#file%,border_width%
#file%,corner_size%
#file%,sleep_time%
#file%,abs$
abs$="Y" absolute_drag%=
absolute_drag%=
#file%
border_width%=20
corner_size%=70
sleep_time%=7
absolute_drag%=
rectangle(x%,y%,width%,height%)
"Wimp_SetColour",4
x%,y%,x%+width%,y%
x%+width%,y%+height%
x%+2,y%+2,x%+width%-2,y%+2
x%+width%-2,y%+height%-2
"Wimp_SetColour",0
x%,y%+2,x%,y%+height%
x%+width%-2,y%+height%
x%+2,y%+4,x%+2,y%+height%-2
x%+width%-4,y%+height%-2
redraw_icon(window%,icon%)
address%!&100=window%
address%!&104=icon%
"Wimp_GetIconState",,address%+&100
"Wimp_ForceRedraw",window%,address%!&108,address%!&10C,address%!&110,address%!&114
redraw_window(address%)
more_rectangles%,width%,height%,x%,y%
[&address%!&100=other_window_handle%
"Wimp_GetWindowState",,address%+&100
address%!&104<>old_min_x%
address%!&108<>old_min_y%
address%!&10C<>old_max_x%
address%!&110<>old_max_y%
address%!&11C<>old_on_top%
address%!&120<>old_highlight%
create_backwindow(address%+&100)
^Ewidth%=old_max_x%-old_min_x%+v_scrollbar_width%+(border_width%*2)
_Xheight%=old_max_y%-old_min_y%+h_scrollbar_height%+titlebar_height%+(border_width%*2)
address%!0=window_handle%
"Wimp_RedrawWindow",,address%
more_rectangles%
more_rectangles%
x%=block%!4
y%=block%!8
e3
rectangle(x%,y%,corner_size%,corner_size%)
fI
rectangle(x%+width%-corner_size%-2,y%,corner_size%,corner_size%)
g`
rectangle(x%+width%-corner_size%-2,y%+height%-corner_size%-2,corner_size%,corner_size%)
hJ
rectangle(x%,y%+height%-corner_size%-2,corner_size%,corner_size%)
iO
rectangle(x%+corner_size%+2,y%,width%-(corner_size%*2)-6,corner_size%)
jf
rectangle(x%+corner_size%+2,y%+height%-corner_size%-2,width%-(corner_size%*2)-6,corner_size%)
kP
rectangle(x%,y%+corner_size%+2,corner_size%,height%-(corner_size%*2)-6)
lf
rectangle(x%+width%-corner_size%-2,y%+corner_size%+2,corner_size%,height%-(corner_size%*2)-6)
m;
"Wimp_GetRectangle",,address%
more_rectangles%
save_preferences
file%,abs$
v'file%=
("<Resizer$Dir>.Preference")
file%<>0
#file%,border_width%
#file%,corner_size%
#file%,sleep_time%
absolute_drag%
abs$="Y"
abs$="N"
#file%,abs$
#file%
42,"Could not write to Preferences file"
set_pointer_shape(name$,x%,y%)
"Wimp_SpriteOp",36,,name$,%100001,x%,y%,0
shape$=name$
wimp_poll
"Wimp_PollIdle",0,block%,
+sleep_time%
reason%,address%
reason%
redraw_window(address%)
open_window(address%)
close_window(!address%)
set_pointer_shape("ptr_default",0,0):last_area%=-1
click(address%)
7:drag_type%=
menu_select(address%)
17,18:
message